#!/bin/sh

rm -rf appcenter/

#rm -rf ./wget-log/appcenter

ldate=$1

if [ ! $ldate ]; then
	echo "IS NULL"
	ldate=$(date +%Y-%m-%d)

	echo "正在下载，日志日期为："
	echo $ldate

	#下载当天的log

	#mkdir -p wget/appcenter

	wget http://logs.neiwang.com/192.168.8.25/logback/ -m -r -np -A *$ldate*.log -R *.html,*.gif -c -P appcenter/

	wget http://logs.neiwang.com/192.168.8.26/logback/ -m -r -np -A *$ldate*.log -R *.html,*.gif -c -P appcenter/

	#下载当前未截断的log
	wget http://logs.neiwang.com/192.168.8.25/logback/web/appcenter-web.log -m -r -np -R *.html,*.gif -c -P appcenter/

	wget http://logs.neiwang.com/192.168.8.26/logback/web/appcenter-web.log -m -r -np -R *.html,*.gif -c -P appcenter/

	wget http://logs.neiwang.com/192.168.8.25/logback/service/appcenter-service.log -m -r -np -R *.html,*.gif -c -P appcenter/

	wget http://logs.neiwang.com/192.168.8.26/logback/service/appcenter-service.log -m -r -np -R *.html,*.gif -c -P appcenter/


	echo "下载结束"

else
	echo "NOT NULL"

	echo "正在下载，日志日期为："
	echo $ldate

	#下载指定日期的log

	#mkdir -p wget/appcenter

	wget http://logs.neiwang.com/192.168.8.25/logback/ -m -r -np -A *$ldate*.log -R *.html,*.gif -c -P appcenter/

	wget http://logs.neiwang.com/192.168.8.26/logback/ -m -r -np -A *$ldate*.log -R *.html,*.gif -c -P appcenter/

	echo "下载结束"


fi



